﻿using Microsoft.Extensions.DependencyInjection;
using Mrc.Config;
using Mrc.SqlSurging;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class SqlSurgarServiceCollectionExtension
    {
        public static void AddSqlSurgar(this IServiceCollection services,Action<SqlSurgarConnectionOptions> action)
        {
            var option = new SqlSurgarConnectionOptions();
            action(option);
            option.Init();//初始化配置连接库
            services.Configure<SqlSurgarConnectionOptions>(thisoptions =>
            {
                thisoptions = option;
            });
            services.AddTransient<ISqlSurgarClientService,SqlSurgarClientService>();
        }
    }
}
